package com.project.controller;

import com.project.bean.StudentBean;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("user")
public class UserController {
    @RequestMapping("checkName")
    public String checkName(String userName){
        if ("java".equals(userName)){
            return "ok";
        }else {
            return "no";
        }
    }
    @RequestMapping("getList")
    public List<StudentBean> getList(){
        List<StudentBean> list = new ArrayList<>();
        list.add(new StudentBean(12,"周淑怡", LocalDate.parse("1998-07-08")));
        list.add(new StudentBean(6,"若若酱", LocalDate.parse("1997-06-18")));
        list.add(new StudentBean(15,"娜娜子", LocalDate.parse("1998-03-28")));
        list.add(new StudentBean(10,"王大娘", LocalDate.parse("1998-12-19")));

        return list;
    }
}
